package com.drop.action;

import java.util.List;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;

import org.apache.struts2.ServletActionContext;
import org.apache.struts2.convention.annotation.Action;
import org.apache.struts2.convention.annotation.Namespace;
import org.apache.struts2.convention.annotation.ParentPackage;
import org.apache.struts2.convention.annotation.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Controller;

import com.drop.entity.Comment;
import com.drop.service.CommentService;
import com.opensymphony.xwork2.ActionContext;
import com.opensymphony.xwork2.ActionSupport;
@Controller
@ParentPackage("struts-default")
@Namespace("/mycom")
@Scope("prototype")
public class MyCommentAction extends ActionSupport{
	@Autowired
	private CommentService coms;
	
	@Action(value = "com",results = {
			@Result(name="mycom",location = "/WEB-INF/person/comment.jsp")
	})
	public String CommentManage()
	{
		HttpServletRequest request = ServletActionContext.getRequest();
		HttpSession session=request.getSession();
		int userid=(int)session.getAttribute("id");
		List<Comment> mycom=coms.getComment(userid);
		ActionContext.getContext().put("mycom", mycom);
		return "mycom";
	}
}
